<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul {
            padding: 0px;
            margin: 10px;
            list-style-type: none;
            display: flex;
            justify-content: space-around;
            align-items: center;
            width: 300px;
            height: 50px;
            border: 1px solid red;
        }
    </style>
</head>
<body>
    <!-- 五星好评☆★ -->
    <ul>
        <li id="1">☆</li>
        <li id="2">☆</li>
        <li id="3">☆</li>
        <li id="4">☆</li>
        <li id="5">☆</li>
    </ul>
    <p></p>
    <button>重置</button>

    <script>
        const ul = document.querySelector("ul")
        const p = document.querySelector("p")
        const btn = document.querySelector("button")
        let li = ul.children
        let lv = ["非常不满意","不满意","部分满意","满意","非常满意"]

        ul.addEventListener("click", function(e) {
                if (e.target.nodeName.toUpperCase() === 'LI') {
                    if (e.target.id <= 5) {
                        let id = e.target.id
                        for (i = 0; i < id; i++) {
                            li[i].innerHTML = "⭐"
                        }
                        p.innerHTML = lv[id - 1]
                    }
                }
        },false)

        btn.addEventListener("click", function(e) {
            for (i = 0; i < 5; i++) {
                li[i].innerHTML = "☆"
            }
            p.innerHTML = ""
        })
    </script>

</body>
</html>